package com.wxyzz.canteenadmin.vip.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wxyzz.canteenadmin.vip.entity.member.dto.MemberAddDTO;
import com.wxyzz.canteenadmin.vip.entity.member.dto.MemberEditDTO;
import com.wxyzz.canteenadmin.vip.entity.member.dto.MemberQueryDTO;
import com.wxyzz.canteenadmin.vip.entity.member.vo.MemberListVO;
import com.wxyzz.canteenadmin.vip.entity.member.vo.MemberVO;
import com.wxyzz.canteenadmin.vip.mapper.MemberMapper;
import com.wxyzz.canteenadmin.vip.service.IMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MemeberServiceImpl implements IMemberService {
    @Autowired
    private MemberMapper memberMapper;


    @Override
    public PageInfo<MemberListVO> list(MemberQueryDTO memberQueryDTO) {
        PageHelper.startPage(memberQueryDTO.getPageNum(),memberQueryDTO.getPageSize());
        List<MemberListVO> memberListVOList = memberMapper.list(memberQueryDTO);
        PageInfo<MemberListVO> listVOPageInfo = new PageInfo<MemberListVO>(memberListVOList);
        return listVOPageInfo;
    }

    @Override
    public Integer add(MemberAddDTO memberAddDTO) {
        return memberMapper.add(memberAddDTO);
    }

    @Override
    public MemberVO getdetail(Integer memberId) {
        return memberMapper.getdetial(memberId);
    }

    @Override
    public Integer update(MemberEditDTO memberEditDTO) {
        return memberMapper.update(memberEditDTO);
    }

    @Override
    public Integer delete(Integer memberId) {
        return memberMapper.delete(memberId);
    }
}
